Skip to content

feat(compute-providers): add AWS EC2 provider modules - #5343

Open
edersonbrilhante wants to merge 4 commits into
mainfrom
refactor-compute-provider-modules
Open

feat(compute-providers): add AWS EC2 provider modules#5343
edersonbrilhante wants to merge 4 commits into
mainfrom
refactor-compute-provider-modules

Conversation

@edersonbrilhante

@edersonbrilhante edersonbrilhante commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Description

Adds the internal AWS EC2 compute-provider module and its trust-policy submodule. The provider owns EC2 runner instances, launch templates, networking, AMI selection, logging, bootstrap configuration, instance profiles, runner IAM policy fragments, and compute-provider validation.

The module exposes a typed provider contract for runner-config and orchestration consumers while keeping shared runner composition and orchestration outside the EC2 implementation.

Test Plan

  • Repository Terraform formatting, validation/TFLint, and merge-conflict checks
  • EC2 provider and trust-policy Terraform tests are included in the PR
  • Local provider-plugin handshake prevented a complete test run on macOS arm64

Related Issues

Depends on #5342.

@edersonbrilhante
edersonbrilhante requested a review from a team as a code owner September 3, 2026 19:05
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@edersonbrilhante
edersonbrilhante requested a review from a team as a code owner September 3, 2026 19:30
@edersonbrilhante
edersonbrilhante force-pushed the refactor-compute-provider-modules branch from bf422c7 to 9d01b81 Compare September 3, 2026 20:14
@edersonbrilhante
edersonbrilhante force-pushed the refactor-compute-provider-modules branch 3 times, most recently from 6c1cb2e to ef7ef08 Compare September 3, 2026 21:51
@edersonbrilhante
edersonbrilhante force-pushed the refactor-compute-provider-modules branch from ef7ef08 to 8375dad Compare September 4, 2026 17:59
@edersonbrilhante
edersonbrilhante force-pushed the refactor-compute-provider-modules branch from 8375dad to 938612c Compare September 7, 2026 15:00
@Brend-Smits
Brend-Smits requested a balanced review from Copilot September 7, 2026 15:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Bootstrap failures, incorrect CloudWatch permissions, and overly broad termination grants must be addressed.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds the internal AWS EC2 compute-provider module and its provider contract.

Changes:

  • Adds EC2 resources, IAM policies, validation, logging, and bootstrap configuration.
  • Adds Linux, Windows, and macOS runner templates.
  • Adds trust-policy support and Terraform tests.
File summaries
File Description
modules/compute-providers/aws/ec2/versions.tf Defines provider requirements.
modules/compute-providers/aws/ec2/variables.tf Defines module inputs.
modules/compute-providers/aws/ec2/validations.tf Validates provider configuration.
modules/compute-providers/aws/ec2/trust-policy/versions.tf Defines trust-module requirements.
modules/compute-providers/aws/ec2/trust-policy/variables.tf Defines trust-policy input.
modules/compute-providers/aws/ec2/trust-policy/validations.tf Validates additional policy JSON.
modules/compute-providers/aws/ec2/trust-policy/tests/trust-policy.tftest.hcl Tests trust-policy behavior.
modules/compute-providers/aws/ec2/trust-policy/README.md Documents the trust module.
modules/compute-providers/aws/ec2/trust-policy/outputs.tf Exports the merged policy.
modules/compute-providers/aws/ec2/trust-policy/assume-role.tf Builds EC2 trust policies.
modules/compute-providers/aws/ec2/tests/provider.tftest.hcl Tests the provider contract.
modules/compute-providers/aws/ec2/templates/user-data.sh Bootstraps Linux runners.
modules/compute-providers/aws/ec2/templates/user-data.ps1 Bootstraps Windows runners.
modules/compute-providers/aws/ec2/templates/user-data-osx.sh Bootstraps macOS runners.
modules/compute-providers/aws/ec2/templates/start-runner.sh Starts Linux runners.
modules/compute-providers/aws/ec2/templates/start-runner.ps1 Starts Windows runners.
modules/compute-providers/aws/ec2/templates/start-runner-osx.sh Starts macOS runners.
modules/compute-providers/aws/ec2/templates/install-runner.sh Installs Linux runner binaries.
modules/compute-providers/aws/ec2/templates/install-runner.ps1 Installs Windows runner binaries.
modules/compute-providers/aws/ec2/templates/install-runner-osx.sh Installs macOS runner binaries.
modules/compute-providers/aws/ec2/templates/cloudwatch_config.json Defines CloudWatch collection.
modules/compute-providers/aws/ec2/runner-instances.tf Creates EC2 runner resources.
modules/compute-providers/aws/ec2/runner-config.tf Stores bootstrap configuration.
modules/compute-providers/aws/ec2/README.md Documents the provider module.
modules/compute-providers/aws/ec2/provider-contract.tf Assembles the provider contract.
modules/compute-providers/aws/ec2/policies-runner.tf Defines runner permissions.
modules/compute-providers/aws/ec2/outputs.tf Exports provider artifacts.
modules/compute-providers/aws/ec2/logging.tf Creates logging resources.
modules/compute-providers/aws/ec2/instance-profile.tf Creates the instance profile.
modules/compute-providers/aws/ec2/control-plane.tf Defines control-plane integration.
Review details

Suppressed comments (2)

modules/compute-providers/aws/ec2/templates/user-data.sh:40

  • With the -e shebang, a failed upgrade terminates user data at this command, so the retry branch is unreachable. Test the command as the if condition instead.
  dnf upgrade-minimal -y

modules/compute-providers/aws/ec2/control-plane.tf:115

  • This standalone legacy-tag statement grants terminate and tag operations across all runner configurations; the later ghr:environment statement is an alternative grant, not an additional restriction. Scope this statement by environment or remove it so one lane's scale-down role cannot modify runners belonging to another lane.
    condition {
      test     = "StringEquals"
      variable = "ec2:ResourceTag/ghr:Application"
      values   = ["github-action-runner"]
    }
  • Files reviewed: 30/30 changed files
  • Comments generated: 11
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread modules/compute-providers/aws/ec2/control-plane.tf
Comment thread modules/compute-providers/aws/ec2/validations.tf
Comment thread modules/compute-providers/aws/ec2/policies-runner.tf
Comment thread modules/compute-providers/aws/ec2/runner-instances.tf
Comment thread modules/compute-providers/aws/ec2/templates/install-runner-osx.sh
Comment thread modules/compute-providers/aws/ec2/templates/start-runner-osx.sh
Comment thread modules/compute-providers/aws/ec2/templates/start-runner-osx.sh
Comment thread modules/compute-providers/aws/ec2/templates/start-runner.ps1
Comment thread modules/compute-providers/aws/ec2/templates/user-data.ps1
Comment thread modules/compute-providers/aws/ec2/templates/user-data.sh
@edersonbrilhante
edersonbrilhante force-pushed the refactor-compute-provider-modules branch 2 times, most recently from 8375d16 to e49356c Compare September 8, 2026 14:47
@edersonbrilhante
edersonbrilhante force-pushed the refactor-compute-provider-modules branch from e49356c to c3be226 Compare September 8, 2026 15:16
@edersonbrilhante
edersonbrilhante force-pushed the refactor-compute-provider-modules branch from c3be226 to 0038ace Compare September 8, 2026 15:41
@edersonbrilhante
edersonbrilhante force-pushed the refactor-compute-provider-modules branch from 0038ace to 1cf71e5 Compare September 8, 2026 16:07
@edersonbrilhante
edersonbrilhante force-pushed the refactor-compute-provider-modules branch from 1cf71e5 to 6d18372 Compare September 8, 2026 16:11
Base automatically changed from replace-legacy-config-consumers to main September 8, 2026 16:20
@edersonbrilhante
edersonbrilhante force-pushed the refactor-compute-provider-modules branch from 6d18372 to a0f38f1 Compare September 8, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants